<template>
  <div class="home-new">
    <home-panel title="新鲜好物" sub-title="新鲜出炉品质靠谱">
      <template #right>
        <more />
      </template>
      <!-- 内容 -->
      <div ref="target" style="position: relative;height: 426px;">
        <Transition name="fade">
          <ul v-if="goods.length" class="goods-list">
            <li v-for="item in goods" :key="item.id" style=" background: #f2f0ee">
              <RouterLink :to="`/product/${item.id}`">
                <img v-lazy="item.picture" alt="">
                <p class="name ellipsis">{{ item.name }}</p>
                <p class="price">&yen;{{ item.price }}</p>
              </RouterLink>
            </li>
          </ul>
          <home-skeleton v-else bg="#f2f0ee" />
        </Transition>
      </div>
    </home-panel>
  </div>
</template>

<script setup>
import HomePanel from './home-panel.vue';
import Home from '@/api/modules/home';
import HomeSkeleton from './home-skeleton.vue';
import { useLazyData } from "@/hooks/index"
const { result: goods, target } = useLazyData(Home.newList)


</script>

<style lang="less" scoped>
.home-new {
  .home-good-list()
}
</style>
